/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 2013-2014 jfinal app. jfapp Group.
 */

define(['adminapp'], function ($app) {
    $app.navactive('game_rule');

    var action_tpl = Handlebars.compile($(g.actiontpl).html());

    $app.listtable({
        'sAjaxSource' : g.ctx + "admin/game/rule/list",
        'aoColumns'   : [
            $app.checkall,
            $app.autono,
            {'mDataProp': 'id' },
            {'mDataProp': 'consume' },
            {'mDataProp': 'free_times' },
            {'mDataProp': 'integral' },
            {'mDataProp': 'use_virtual_currency' },
            {'mDataProp': 'virtual_currency' },
            {'mDataProp': 'begin_time' },
            {'mDataProp': 'end_time' },
            {'mDataProp': 'winning_numbers' }
        ],
        'aoColumnDefs': [
            {
                'aTargets': [2],
                'mData'   : null,
                'mRender' : function (data, type, full) {
                    return full['winning']+"/"+full['total'];
                }
            },{
                'aTargets': [3],
                'mData'   : 'free_times',
                'mRender' : function (data, type, full) {
                    return full['free_times'];
                }
            },
            {
                'aTargets': [4],
                'mData'   : null,
                'mRender' : function (data, type, full) {
                    return full['consume'] ? '是' : '否';
                }
            },
            {
                'aTargets': [6],
                'mData'   : null,
                'mRender' : function (data, type, full) {
                    return full['use_virtual_currency'] ? '是' : '否';
                }
            },
            {
                'aTargets': [11],
                'mData'   : null,
                'mRender' : function (data, type, full) {
                    return action_tpl(full);
                }
            }
        ]
    }, 'data-list');
});

